import requests
import json

url = "https://worklist.linkingopen.com/rest/api/2/issue/"

payload = json.dumps({
   "fields": {
      "project": {
         "key": "DTWIN"
      },
      "summary": "No REST for the Wicked.",
      "description": "Creating of an issue using key for projects and issue types using the REST API",
      "attachment": [],
      "issuetype": {
         "name": "任务"
      }
   }
})
headers = {
   'Authorization': 'Basic amlhd2VpLm06QWNjcDEyMzQ=',
   'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)
body = json.loads(response.text)
print(response.text)
issue_id = body['id']
issue_key = body['key']
url = "https://worklist.linkingopen.com/rest/api/2/issue/" + issue_id+'/attachments'

print(response.text)
